const mongoose = require('mongoose');
//创建学生集合规则
const studentsSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true,
        minlength: 2,
        maxlength:10
    },
    age: {
        type: Number,
        min: 10,
        max: 80,
    },
    sex: {
        type:String
    },
    email: String,
    hobbies: [String],
    collage: String,
    enterDate: {
        type: Date,
        //没写日期默认当前时间
        default:Date.now()
    }
});
//创建学生集合
const Student = mongoose.model('Student', studentsSchema);
//开放构造函数出去
module.exports = Student;